#!/bin/sh

[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=./jre


export JAVA="$JAVA_HOME/bin/java"
export BASE_DIR=$(dirname $0)
export CLASSPATH=.:${BASE_DIR}/conf:${BASE_DIR}/lib/*:${CLASSPATH}

JAVA_OPT="${JAVA_OPT} -Xms128m -Xmx128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m"
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
JAVA_OPT="${JAVA_OPT} -Dlog_back_config=logback.xml -cp ${CLASSPATH}"

$JAVA ${JAVA_OPT} com.hairou.Main -c config.conf $@
